﻿using System;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows;
using WPF_CAD.Model;

namespace WPF_CAD.Common
{
    public class FigureDrawer
    {
        public static void DrawFigure(Canvas canvas, IFigure figure)
        {
            DrawFigure(canvas, figure, Colors.Black);
        }

        public static void DrawFigure(Canvas canvas, IFigure figure, Color color)
        {
            foreach (var point in figure.PointsCollection)
            {
                canvas.Children.Add(new Rectangle
                {
                    Height = 1,
                    Width = 1,
                    Fill = new SolidColorBrush(color),
                    Margin = new Thickness(point.X,
                                           point.Y,
                                           point.X,
                                           point.Y)
                });
            }
        }
    }
}
